/*
 * Test every method in GenericEvents except to_string()
 * Missing: test setdate, setTime
 */

package tester;

import static org.junit.Assert.*;

import java.util.Calendar;
import java.util.GregorianCalendar;

import memory.GenericEvents;

import org.junit.Test;

public class TestGenericEvents {
	
	private Calendar start = new GregorianCalendar();
	private Calendar end = new GregorianCalendar();
	
	//@author A0085082E
	@Test
	public void test() {
	
		start.set(2014, 03, 27, 03, 14, 20);
		end.set(2015, 02, 05, 07, 11, 13);
		
		add_Event();
		add_Deadline();
		add_Task();
		
		testOtherMethods();
	}

	
	private void add_Event(){
		
		GenericEvents testEvent = new GenericEvents("event", "this is name", "this is description", start, end, 0);
		assertEquals("Type", testEvent.getType(), "event");
		assertEquals("Name", testEvent.getName(), "this is name");
		assertEquals("Description", testEvent.getDescription(), "this is description");
		assertEquals("start time and date", testEvent.getStart(), start);
		assertEquals("end time and date", testEvent.getEnd(), end);
	}
	
	private void add_Deadline(){
		GenericEvents testDeadline = new GenericEvents("deadline", "this is name1", "this is description1", end);
		assertEquals("Type", testDeadline.getType(), "deadline");
		assertEquals("Name", testDeadline.getName(), "this is name1");
		assertEquals("Description", testDeadline.getDescription(), "this is description1");
		assertEquals("start time and date", testDeadline.getStart(), null);
		assertEquals("end time and date", testDeadline.getEnd(), end);
	}
	
	private void add_Task(){
		GenericEvents testTask = new GenericEvents("task", "this is name2", "this is description2");
		assertEquals("Type", testTask.getType(), "task");
		assertEquals("Name", testTask.getName(), "this is name2");
		assertEquals("Description", testTask.getDescription(), "this is description2");
		assertEquals("start time and date", testTask.getStart(), null);
		assertEquals("end time and date", testTask.getEnd(), null);
	}
	
	private void testOtherMethods(){
		GenericEvents testMethod = new GenericEvents("Method", "name2", "description2");
		assertEquals("start time and date", testMethod.getStart(), null);
		testMethod.initStart();
		assertFalse("start time and date", testMethod.getStart()== null);
		
		assertEquals("end time and date", testMethod.getEnd(), null);
		testMethod.initEnd();
		assertFalse("start time and date", testMethod.getEnd()== null);
		
		testMethod.setType("meow");
		assertEquals("type", testMethod.getType(), "meow");
		
		testMethod.setName("Not a top-down multi-level design description. One symptom of this is including low level details in the architecture diagram. The example below includes too much details although it is multi-level.");
		assertEquals("Name", testMethod.getName(), "Not a top-down multi-level design description. One symptom of this is including low level details in the architecture diagram. The example below includes too much details although it is multi-level.");
		
		testMethod.setDescription("Another symptom of this problem is all-in-one class/sequence diagrams that spans multiple components. Having low-level all-in-one diagrams can incur severe penalties during final project manual grading.  Here are some examples. ");
		assertEquals("Description", testMethod.getDescription(), "Another symptom of this problem is all-in-one class/sequence diagrams that spans multiple components. Having low-level all-in-one diagrams can incur severe penalties during final project manual grading.  Here are some examples. ");
		
		testMethod.setStartTime(03, 14);
		testMethod.setEndTime(07, 11);
		
		testMethod.setStartDate(2014, 03, 27);
		testMethod.setEndDate(2015, 02, 05);
		
	}
	
	
	
}
